package com.linln.modules.tribe.repository;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.linln.modules.system.repository.BaseRepository;
import com.linln.modules.tribe.domain.Tribe;

/**
 * @author 左书亮
 * @date 2019/10/10
 */
public interface TribeRepository extends BaseRepository<Tribe, Long> {
	
	
	@Modifying
	@Transactional
	@Query("update Tribe set collectnum = collectnum+1  where id = ?1 ")
	public Integer updateIsCollectAddById(Long id);
	
	
	@Modifying
	@Transactional
	@Query("update Tribe set commentnum = commentnum+1  where id = ?1 ")
	public Integer updateIsReplyAddById(Long id);

	@Modifying
	@Transactional
	@Query("update Tribe set zannum = zannum+1  where id = ?1 ")
	public Integer updateIsZanAddById(Long id);


	@Modifying
	@Transactional
	@Query("update Tribe set collectnum = collectnum-1  where id = ?1 ")
	public Integer updateIsCollectSubById(Long id);
	
}